<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link href="<%=path%>/CSS/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<script type="text/javascript"
	src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
.seachform li label {line-height: 45px;color: #444444}
.scinput {line-height: 10px;margin-top: 5px}
.scinput1 {margin-top: 5px;height: 30px;}
.scbtn {background: #57a0ff;border-radius: 20px;width: 110px;margin-top: 4px;height: 35px}
thead {background: #f2f2f2}
.tablelist2 th {height: 45px;background: none;}
.tablelist2 tr{height:45px;}
.tablelist2 tr th{height: 20px;border-left: 1px solid #dddee6;border-right: 1px solid #dddee6;color: #444444;text-align: center;}
.tou{background: #e4eafe}
.kh{border-bottom: 1px solid #dddee6;}
.shuju td{border-left: 1px solid #dddee6;border-right: 1px solid #dddee6;color: #787c88;text-align: center;}
.shuju:nth-child(odd){background: #ffffff}
.shuju:nth-child(even){background: #f3f5fb}
.shuju:last-child{border-bottom: 1px solid #dddee6;}
.shuju:HOVER {
	background: #fff6cd;
}
 .loading {
            margin: 200px 600px;
            display: block;
            width: 65px;
            height: 65px;
            border: 1px solid #ddd;
            border-radius: 5px;
            opacity: .7;
	 background: url(<%=path%>/images/loading.gif) no-repeat;
        }
#xchj td,#dchj td,#dcb1 td,#dcb2 td,#dca1 td,#dca2 td,#dca3 td{border-bottom: 1px solid #dddee6;}
.zj{border-bottom: 1px solid #dddee6;background: yellow;}
.hj{border-bottom: 1px solid #dddee6;}
.time{width: 40px;}
.time2{width: 50px}

.scbtn {
	outline: none;
}
</style>
</head>
<body style="background: #f5f5f5;padding: 0 10px;">
	<div class="place" style="background: #f5f5f5; margin-top: 10px">
		<ul class="placeul">
			<li><a href="#">报表</a></li>
			<li><a href="#">财务报表</a></li>
			<li><a href="<%=path%>/DrivingSys/queryTrainingStatistics/look.action">招生培训人数统计日表</a></li>
		</ul>
	</div>

	<div class="rightinfo"
		style="background: #fff; border-radius: 10px; height: 45px;">

		<form action="<%=path%>/DrivingSys/outXls" class="form" method="post" >
			<ul class="seachform">
					<li><label>考试时间</label> <input
					type="text" name="time" id="ksrq" value="${time}" class="scinput1"
					onclick="WdatePicker({el:'ksrq',dateFmt:'yyyy-MM'})" />
					
					<input type="hidden" name="xls" id="xls" value="">
					<input type="hidden" name="fileNames" value="招生、培训、考试人数统计表">
					<input type="hidden" id="stu">
					</li>
				<%-- <li><label>结束时间</label><input class="scinput1" name="endTime"
					type="text"
					onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd'})"
					id="datemax" class="input-text Wdate" style="width: 150px;"
					value="${endTime}">
					<input type="hidden" name="xls" id="xls" value="">
					<input type="hidden" name="fileNames" value="招生、培训、考试人数统计表">
					<input type="hidden" id="stu">
				</li> --%>
				<li><label>&nbsp;</label><input name="" type="button"
												class="scbtn" value="立即查询" id="cx"/></li>
				<shiro:hasPermission name="/outXlsTrainingStatistics">
					<li><label>&nbsp;</label><input onclick="chargeCss()" type="submit" id="dc"
													class="scbtn" value="导出Excel" /></li>
				</shiro:hasPermission>
			</ul>
		</form>
	</div>

	<div style="width: 100%; overflow: auto; margin-bottom: 20px; margin-top: 30px; background: #fff; box-shadow: 0 0 10px #f2f2f2; min-height: 600px" class="div">
		<table class="tablelist2" style="width: auto; white-space: nowrap;"id="table1">
			
		</table>
	</div>
	<div id="hidden" style="display: none">
	
	</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
	$('#table1').html("<tr><td class='loading'></td></tr>");
	var startTime = "${time}";
	var str = ''
	$.ajax({
		url: '<%=path%>/DrivingSys/queryTrainingStatisticsByTime',
        type: "post",
        data: {'startTime':startTime},
        dataType: "json",
        async: true,
        success:function(json){
        	var list_time = new Array();  
        	 str += '<tr style="display: none;" class="tou">'
	         str += '<th style="text-align: center;height:30px;" colspan= "'+(json.length*1+5)+'">招生、培训、考试人数统计表</th></tr>'
	         str += '<tr style="display: none;" class="tou"><th colspan="2">单位名称</th>'
	         for(var i = 0;i<json.length-1;i++){
	         	str +='<th style="" class="time"></th>' 
	         }
		     str += '<th style="text-align: right;height:30px;width:5px" colspan= "2">时间：'+startTime+'</th><th colspan="2">单位：人</th></tr>'
	         str += '<tr class="tou" style="height:55px"><th style="width:15px">类别</th><th style="width:25px">项目</th><th class="time2">预算</th>'
        	for(var i = 0;i<json.length;i++){
        		str +='<th style="" class="time">'+json[i]+'日</th>' 
        		list_time[i] = startTime+"-"+json[i]
        	}
			str+='<th class="time">合计</th><th class="time">完成率</th></tr>'
			 $.ajax({
				url: '<%=path%>/DrivingSys/queryTrainingStatisticsData',
				type: "post",
				data: {'startTime':list_time[0],'endTime':list_time[list_time.length-1]},
				dataType: "json",
				async: false,
				success:function(json){
					dataAll(json,list_time,str)	
				},
				error:function(){alert("错误")}
			 })
        },
        error:function(){alert("错误")}
	})
})

//改变样式
function chargeCss(){
	$("#hidden").html($(".div").html())
	//$("#hidden table .tou th:nth-child(2)").css("width","25px");
	//$("#hidden table .tou th:nth-child(1)").css("width","12px"); 
	//$("#hidden table .tou th:nth-child(2)").css("width","15px"); 
	
	$("#hidden table .tou th").css("text-align","center");
	 
	$("#hidden table tr th").css("font-weight","bold"); 
	
	$("#hidden .shuju td:odd").css("text-align","center");
	$("#hidden .shuju td:even").css("text-align","center");
	
	$("#hidden .shuju td").css("font-size","11pt");
	$("#hidden .tou th").css("font-size","11pt");
	$("#hidden .tou th").css("background","rgb(228,234,254)");
	$("#hidden table tr .zj").css("background","yellow")
	$("#xls").val($("#hidden").html())
}

//查询数据
$("#cx").click(function(){
	var startTime = $("#ksrq").val();
	if(startTime == null || startTime == ''){
		alert("时间不能未空")
		return false
	}
	$('#table1').html("<tr><td class='loading'></td></tr>");
	var str = ''
	$.ajax({
		url: '<%=path%>/DrivingSys/queryTrainingStatisticsByTime',
        type: "post",
        data: {'startTime':startTime},
        dataType: "json",
        async: true,
        success:function(json){
        	var list_time = new Array();  
        	 str += '<tr style="display: none;" class="tou">'
    	         str += '<th style="text-align: center;height:30px;" colspan= "'+(json.length*1+5)+'">招生、培训、考试人数统计表</th></tr>'
    	         str += '<tr style="display: none;" class="tou"><th colspan="2">单位名称</th>'
    	         for(var i = 0;i<json.length-1;i++){
    	         	str +='<th style="" class="time"></th>' 
    	         }
    		     str += '<th style="text-align: right;height:30px;width:5px" colspan= "2">时间：'+startTime+'</th><th colspan="2">单位：人</th></tr>'
    	         str += '<tr class="tou" style="height:55px"><th style="width:15px">类别</th><th style="width:25px">项目</th><th class="time2">预算</th>'
        	for(var i = 0;i<json.length;i++){
        		str +='<th class="time">'+json[i]+'日</th>' 
        		list_time[i] = startTime+"-"+json[i]
        	}
			str+='<th class="time">合计</th><th class="time">完成率</th></tr>'
			 $.ajax({
				url: '<%=path%>/DrivingSys/queryTrainingStatisticsData',
				type: "post",
				data: {'startTime':list_time[0],'endTime':list_time[list_time.length-1]},
				dataType: "json",
				async: false,
				success:function(json){
					dataAll(json,list_time,str)	
				},
				error:function(){alert("错误")}
			 })
        },
        error:function(){alert("错误")}
	})
})

//放入数据
function dataAll(json,list_time,str){
	str +='<tr class="shuju zsrs"><td rowspan="9" class="hj">小车合计</td><td>招生人数</td><td></td>'
		if(json.trainingStatistics == null){
			 for(var i = 0;i<list_time.length;i++){
				    var xczsrs = 0;
					str +='<td>0</td>'
				} 
		}else{
			 var xc = 0;
			 var xczsrs = 0;
			 for(var i = 0;i<list_time.length;i++){
				 if(xc >= json.trainingStatistics.length){
					 str +='<td>0</td>'
				 }else{
					 if(json.trainingStatistics[xc].dayTime == list_time[i]){
						var rs =  json.trainingStatistics[xc].carTypeC1*1 +json.trainingStatistics[xc].carTypeC2*1+json.trainingStatistics[xc].carTypeC3*1
							str +='<td>'+rs+'</td>'
							xc = xc*1+1;
							xczsrs = rs+xczsrs*1;
						}else{
							str +='<td>0</td>'
						} 
				 }
			} 
		}
		str +='<td>'+xczsrs+'</td><td></td></tr>'
		//放入小车科目二培训人数
		str +='<tr class="shuju"><td>科目二培训人数</td><td></td>'
		str = data(json.kmepxrs,list_time,str);
		
		//放入小车科目二及格人数
		str +='<tr class="shuju"><td>科目二及格人数</td><td></td>'
		str = data(json.kmejgrs,list_time,str);
		
		//放入小车科目三培训人数
		str +='<tr class="shuju"><td>科目三培训人数</td><td></td>'
		str = data(json.kmspxrs,list_time,str);	
		
		//放入小车科目三及格人数
		str +='<tr class="shuju"><td>科目三及格人数</td><td></td>'
		str = data(json.kmsjgrs,list_time,str);
		
		//放入小车非本校科目二考试人数
		str +='<tr class="shuju"><td>非本校科目二考试人数</td><td></td>'
		str = data(json.kmewxksrs,list_time,str);
		
		//放入小车非本校科目三考试人数
		str +='<tr class="shuju"><td>非本校科目三考试人数</td><td></td>'
		str = data(json.kmswxksrs,list_time,str);
		
		//放入小车科目二考前训练人数
		str +='<tr class="shuju"><td>科目二考前训练人数</td><td></td>'
		str = data(json.kmekqxlrs,list_time,str);
		
		//放入小车科目三考前训练人数
		str +='<tr class="shuju" id="xchj"><td>科目三考前训练人数</td><td></td>'
		str = data(json.kmskqxlrs,list_time,str);
		str +='</tr>'
		//放入大车合计
		str +='<tr class="shuju zsrs"><td rowspan="9" class="hj">大车合计</td><td>招生人数</td><td></td>'
			if(json.trainingStatistics == null){
				for(var i = 0;i<list_time.length;i++){
					var xczsrs = 0;
					str +='<td>0</td>'
				} 
			}else{
				var xc = 0;
				var xczsrs = 0;
				for(var i = 0;i<list_time.length;i++){
					 if(xc >= json.trainingStatistics.length){
						str +='<td>0</td>'
					}else{
						if(json.trainingStatistics[xc].dayTime == list_time[i]){
						var rs =  json.trainingStatistics[xc].carTypeA1*1 +json.trainingStatistics[xc].carTypeA2*1+json.trainingStatistics[xc].carTypeA3*1+json.trainingStatistics[xc].carTypeB1*1+json.trainingStatistics[xc].carTypeB2*1
							str +='<td>'+rs+'</td>'
							xc = xc*1+1;
							xczsrs = rs+xczsrs*1;
						}else{
							str +='<td>0</td>'
						} 
					}
				} 
			}
		str +='<td>'+xczsrs+'</td><td></td></tr>'
		
		//放入大车科目二培训人数
		str +='<tr class="shuju"><td>科目二培训人数</td><td></td>'
		str = bigCarData(json.kmepxrs,list_time,str);
		
		//放入大车科目二及格人数
		str +='<tr class="shuju"><td>科目二及格人数</td><td></td>'
		str = bigCarData(json.kmejgrs,list_time,str);
		
		//放入大车科目三培训人数
		str +='<tr class="shuju"><td>科目三培训人数</td><td></td>'
		str = bigCarData(json.kmspxrs,list_time,str);
		
		//放入大车科目三及格人数
		str +='<tr class="shuju"><td>科目三及格人数</td><td></td>'
		str = bigCarData(json.kmsjgrs,list_time,str);
		
		//放入大车非本校科目二考试人数
		str +='<tr class="shuju"><td>非本校科目二考试人数</td><td></td>'
		str = bigCarData(json.kmewxksrs,list_time,str);
		
		//放入大车非本校科目三考试人数
		str +='<tr class="shuju"><td>非本校科目三考试人数</td><td></td>'
		str = bigCarData(json.kmswxksrs,list_time,str);
		
		//放入大车科目二考前训练人数
		str +='<tr class="shuju"><td>科目二考前训练人数</td><td></td>'
		str = bigCarData(json.kmekqxlrs,list_time,str);
		
		//放入大车科目三考前训练人数
		str +='<tr class="shuju" id="dchj"><td>科目三考前训练人数</td><td></td>'
		str = bigCarData(json.kmskqxlrs,list_time,str);
		
		//放入大车按车型B1数据
		str +='<tr class="shuju zsrs"><td rowspan="7" class="hj">大车按车型B1</td><td>招生人数</td><td></td>'
			if(json.trainingStatistics == null){
				for(var i = 0;i<list_time.length;i++){
					var xczsrs = 0;
					str +='<td>0</td>'
				} 
			}else{
				var xc = 0;
				var xczsrs = 0;
				for(var i = 0;i<list_time.length;i++){
					 if(xc >= json.trainingStatistics.length){
						str +='<td>0</td>'
					}else{
						if(json.trainingStatistics[xc].dayTime == list_time[i]){
						var rs = json.trainingStatistics[xc].carTypeB1*1;
							str +='<td>'+rs+'</td>'
							xc = xc*1+1;
							xczsrs = rs+xczsrs*1;
						}else{
							str +='<td>0</td>'
						} 
					}
				} 
			}
		str +='<td>'+xczsrs+'</td><td></td></tr>'
		//放入大车B1科目二培训人数
		str +='<tr class="shuju"><td>科目二培训人数</td><td></td>'
		str = bigCarTypeData(json.kmepxrs,list_time,str,"B1");
		
		//放入大车B1科目二及格人数
		str +='<tr class="shuju"><td>科目二及格人数</td><td></td>'
		str = bigCarTypeData(json.kmejgrs,list_time,str,"B1");
		
		//放入大车B1科目三培训人数
		str +='<tr class="shuju"><td>科目三培训人数</td><td></td>'
		str = bigCarTypeData(json.kmspxrs,list_time,str,"B1");
		
		//放入大车B1科目三及格人数
		str +='<tr class="shuju"><td>科目三及格人数</td><td></td>'
		str = bigCarTypeData(json.kmsjgrs,list_time,str,"B1");
		
		//放入大车B1非本校科目二考试人数
		str +='<tr class="shuju"><td>非本校科目二考试人数</td><td></td>'
		str = bigCarTypeData(json.kmewxksrs,list_time,str,"B1");
		
		//放入大车B1非本校科目三考试人数
		str +='<tr class="shuju" id="dcb1"><td>非本校科目三考试人数</td><td></td>'
		str = bigCarTypeData(json.kmswxksrs,list_time,str,"B1");
		
		//放入大车按车型B2数据
		str +='<tr class="shuju zsrs"><td rowspan="7" class="hj">大车按车型B2</td><td>招生人数</td><td></td>'
			if(json.trainingStatistics == null){
				for(var i = 0;i<list_time.length;i++){
					var xczsrs = 0;
					str +='<td>0</td>'
				} 
			}else{
				var xc = 0;
				var xczsrs = 0;
				for(var i = 0;i<list_time.length;i++){
					 if(xc >= json.trainingStatistics.length){
						str +='<td>0</td>'
					}else{
						if(json.trainingStatistics[xc].dayTime == list_time[i]){
						var rs = json.trainingStatistics[xc].carTypeB2*1;
							str +='<td>'+rs+'</td>'
							xc = xc*1+1;
							xczsrs = rs+xczsrs*1;
						}else{
							str +='<td>0</td>'
						} 
					}
				} 
			}
		str +='<td>'+xczsrs+'</td><td></td></tr>'
		//放入大车B2科目二培训人数
		str +='<tr class="shuju"><td>科目二培训人数</td><td></td>'
		str = bigCarTypeData(json.kmepxrs,list_time,str,"B2");
		
		//放入大车B2科目二及格人数
		str +='<tr class="shuju"><td>科目二及格人数</td><td></td>'
		str = bigCarTypeData(json.kmejgrs,list_time,str,"B2");
		
		//放入大车B2科目三培训人数
		str +='<tr class="shuju"><td>科目三培训人数</td><td></td>'
		str = bigCarTypeData(json.kmspxrs,list_time,str,"B2");
		
		//放入大车B2科目三及格人数
		str +='<tr class="shuju"><td>科目三及格人数</td><td></td>'
		str = bigCarTypeData(json.kmsjgrs,list_time,str,"B2");
		
		//放入大车B2非本校科目二考试人数
		str +='<tr class="shuju"><td>非本校科目二考试人数</td><td></td>'
		str = bigCarTypeData(json.kmewxksrs,list_time,str,"B2");
		
		//放入大车B2非本校科目三考试人数
		str +='<tr class="shuju" id="dcb2"><td>非本校科目三考试人数</td><td></td>'
		str = bigCarTypeData(json.kmswxksrs,list_time,str,"B2");
		
		//放入大车按车型A1数据
		str +='<tr class="shuju zsrs"><td rowspan="7" class="hj">大车按车型A1</td><td>招生人数</td><td></td>'
			if(json.trainingStatistics == null){
				for(var i = 0;i<list_time.length;i++){
					var xczsrs = 0;
					str +='<td>0</td>'
				} 
			}else{
				var xc = 0;
				var xczsrs = 0;
				for(var i = 0;i<list_time.length;i++){
					 if(xc >= json.trainingStatistics.length){
						str +='<td>0</td>'
					}else{
						if(json.trainingStatistics[xc].dayTime == list_time[i]){
						var rs = json.trainingStatistics[xc].carTypeA1*1;
							str +='<td>'+rs+'</td>'
							xc = xc*1+1;
							xczsrs = rs+xczsrs*1;
						}else{
							str +='<td>0</td>'
						} 
					}
				} 
			}
		str +='<td>'+xczsrs+'</td><td></td></tr>'
		//放入大车A1科目二培训人数
		str +='<tr class="shuju"><td>科目二培训人数</td><td></td>'
		str = bigCarTypeData(json.kmepxrs,list_time,str,"A1");
		
		//放入大车A1科目二及格人数
		str +='<tr class="shuju"><td>科目二及格人数</td><td></td>'
		str = bigCarTypeData(json.kmejgrs,list_time,str,"A1");
		
		//放入大车A1科目三培训人数
		str +='<tr class="shuju"><td>科目三培训人数</td><td></td>'
		str = bigCarTypeData(json.kmspxrs,list_time,str,"A1");
		
		//放入大车A1科目三及格人数
		str +='<tr class="shuju"><td>科目三及格人数</td><td></td>'
		str = bigCarTypeData(json.kmsjgrs,list_time,str,"A1");
		
		//放入大车A1非本校科目二考试人数
		str +='<tr class="shuju"><td>非本校科目二考试人数</td><td></td>'
		str = bigCarTypeData(json.kmewxksrs,list_time,str,"A1");
		
		//放入大车A1非本校科目三考试人数
		str +='<tr class="shuju" id="dca1"><td>非本校科目三考试人数</td><td></td>'
		str = bigCarTypeData(json.kmswxksrs,list_time,str,"A1");
		
		//放入大车按车型A2数据
		str +='<tr class="shuju zsrs"><td rowspan="7" class="hj">大车按车型A2</td><td>招生人数</td><td></td>'
			if(json.trainingStatistics == null){
				for(var i = 0;i<list_time.length;i++){
					var xczsrs = 0;
					str +='<td>0</td>'
				} 
			}else{
				var xc = 0;
				var xczsrs = 0;
				for(var i = 0;i<list_time.length;i++){
					 if(xc >= json.trainingStatistics.length){
						str +='<td>0</td>'
					}else{
						if(json.trainingStatistics[xc].dayTime == list_time[i]){
						var rs = json.trainingStatistics[xc].carTypeA2*1;
							str +='<td>'+rs+'</td>'
							xc = xc*1+1;
							xczsrs = rs+xczsrs*1;
						}else{
							str +='<td>0</td>'
						} 
					}
				} 
			}
		str +='<td>'+xczsrs+'</td><td></td></tr>'
		//放入大车A2科目二培训人数
		str +='<tr class="shuju"><td>科目二培训人数</td><td></td>'
		str = bigCarTypeData(json.kmepxrs,list_time,str,"A2");
		
		//放入大车A2科目二及格人数
		str +='<tr class="shuju"><td>科目二及格人数</td><td></td>'
		str = bigCarTypeData(json.kmejgrs,list_time,str,"A2");
		
		//放入大车A1科目三培训人数
		str +='<tr class="shuju"><td>科目三培训人数</td><td></td>'
		str = bigCarTypeData(json.kmspxrs,list_time,str,"A2");
		
		//放入大车A2科目三及格人数
		str +='<tr class="shuju"><td>科目三及格人数</td><td></td>'
		str = bigCarTypeData(json.kmsjgrs,list_time,str,"A2");
		
		//放入大车A2非本校科目二考试人数
		str +='<tr class="shuju"><td>非本校科目二考试人数</td><td></td>'
		str = bigCarTypeData(json.kmewxksrs,list_time,str,"A2");
		
		//放入大车A2非本校科目三考试人数
		str +='<tr class="shuju" id="dca2"><td>非本校科目三考试人数</td><td></td>'
		str = bigCarTypeData(json.kmswxksrs,list_time,str,"A2");
		
		//放入大车按车型A3数据
		str +='<tr class="shuju zsrs"><td rowspan="7" class="hj">大车按车型A3</td><td>招生人数</td><td></td>'
			if(json.trainingStatistics == null){
				for(var i = 0;i<list_time.length;i++){
					var xczsrs = 0;
					str +='<td>0</td>'
				} 
			}else{
				var xc = 0;
				var xczsrs = 0;
				for(var i = 0;i<list_time.length;i++){
					 if(xc >= json.trainingStatistics.length){
						str +='<td>0</td>'
					}else{
						if(json.trainingStatistics[xc].dayTime == list_time[i]){
						var rs = json.trainingStatistics[xc].carTypeA3*1;
							str +='<td>'+rs+'</td>'
							xc = xc*1+1;
							xczsrs = rs+xczsrs*1;
						}else{
							str +='<td>0</td>'
						} 
					}
				} 
			}
		str +='<td>'+xczsrs+'</td><td></td></tr>'
		//放入大车A3科目二培训人数
		str +='<tr class="shuju"><td>科目二培训人数</td><td></td>'
		str = bigCarTypeData(json.kmepxrs,list_time,str,"A3");
		
		//放入大车A3科目二及格人数
		str +='<tr class="shuju"><td>科目二及格人数</td><td></td>'
		str = bigCarTypeData(json.kmejgrs,list_time,str,"A3");
		
		//放入大车A3科目三培训人数
		str +='<tr class="shuju"><td>科目三培训人数</td><td></td>'
		str = bigCarTypeData(json.kmspxrs,list_time,str,"A3");
		
		//放入大车A3科目三及格人数
		str +='<tr class="shuju"><td>科目三及格人数</td><td></td>'
		str = bigCarTypeData(json.kmsjgrs,list_time,str,"A3");
		
		//放入大车A3非本校科目二考试人数
		str +='<tr class="shuju"><td>非本校科目二考试人数</td><td></td>'
		str = bigCarTypeData(json.kmewxksrs,list_time,str,"A3");
		
		//放入大车A3非本校科目三考试人数
		str +='<tr class="shuju" id="dca2"><td>非本校科目三考试人数</td><td></td>'
		str = bigCarTypeData(json.kmswxksrs,list_time,str,"A3");
		
		
		//总计数据
		str +='<tr class="shuju" id="zj"><td rowspan="7" class="zj">总计</td><td>招生人数</td><td></td>'
			if(json.trainingStatistics == null){
				for(var i = 0;i<list_time.length;i++){
					var xczsrs = 0;
					str +='<td>0</td>'
				} 
			}else{
				var xc = 0;
				var xczsrs = 0;
				for(var i = 0;i<list_time.length;i++){
					 if(xc >= json.trainingStatistics.length){
						str +='<td>0</td>'
					}else{
						if(json.trainingStatistics[xc].dayTime == list_time[i]){
						var rs = json.trainingStatistics[xc].carTypeC1*1+json.trainingStatistics[xc].carTypeC2*1+json.trainingStatistics[xc].carTypeC3*1;
							str +='<td>'+rs+'</td>'
							xc = xc*1+1;
							xczsrs = rs+xczsrs*1;
						}else{
							str +='<td>0</td>'
						} 
					}
				} 
			}
		str +='<td>'+xczsrs+'</td><td></td></tr>'
		//总计数据科目二培训人数
		str +='<tr class="shuju"><td>科目二培训人数</td><td></td>'
		str = zjData(json.kmepxrs,list_time,str);
		
		//总计数据科目二及格人数
		str +='<tr class="shuju"><td>科目二及格人数</td><td></td>'
		str = zjData(json.kmejgrs,list_time,str);
		
		//总计数据科目三培训人数
		str +='<tr class="shuju"><td>科目三培训人数</td><td></td>'
		str = zjData(json.kmspxrs,list_time,str);
		
		//总计数据科目三及格人数
		str +='<tr class="shuju"><td>科目三及格人数</td><td></td>'
		str = zjData(json.kmsjgrs,list_time,str);
		
		//总计数据非本校科目二考试人数
		str +='<tr class="shuju"><td>非本校科目二考试人数</td><td></td>'
		str = zjData(json.kmewxksrs,list_time,str);
		
		//总计数据非本校科目三考试人数
		str +='<tr class="shuju" id="dca2"><td>非本校科目三考试人数</td><td></td>'
		str = zjData(json.kmswxksrs,list_time,str);
		$("#table1").html(str)
}


//放入总计数据
function zjData(json,list_time,str){
	if(json == null){
		 for(var i = 0;i<list_time.length;i++){
			    var xczsrs = 0;
				str +='<td>0</td>'
			} 
	}else{
		 var xc = 0;
		 var xczsrs = 0;
		 for(var i = 0;i<list_time.length;i++){
			 if(xc >= json.length){
				 str +='<td>0</td>'
			 }else{
				 if(json[xc].dayTime == list_time[i]){
					 var rs = json[xc].num;
						str +='<td>'+rs+'</td>'
						xc = xc*1+1;
						xczsrs = rs+xczsrs*1;
					}else{
						str +='<td>0</td>'
					} 
			 }
		} 
	}
	str +='<td>'+xczsrs+'</td><td></td></tr>'
	return str;
}

//放入大车合计数据
function bigCarTypeData(json,list_time,str,cartype){
	if(json == null){
		 for(var i = 0;i<list_time.length;i++){
			    var xczsrs = 0;
				str +='<td>0</td>'
			} 
	}else{
		 var xc = 0;
		 var xczsrs = 0;
		 for(var i = 0;i<list_time.length;i++){
			 if(xc >= json.length){
				 str +='<td>0</td>'
			 }else{
				 if(json[xc].dayTime == list_time[i]){
					 var rs;
					 if(cartype == "B1"){
						 rs = json[xc].carTypeB1*1;
					 }else if(cartype == "B2"){
						 rs = json[xc].carTypeB2*1;
					 }else if(cartype == "A1"){
						 rs = json[xc].carTypeA1*1;
					 }else if(cartype == "A2"){
						 rs = json[xc].carTypeA2*1;
					 }else if(cartype == "A3"){
						 rs = json[xc].carTypeA3*1;
					 }else{
						 rs = 0;
					 }
						str +='<td>'+rs+'</td>'
						xc = xc*1+1;
						xczsrs = rs+xczsrs*1;
					}else{
						str +='<td>0</td>'
					} 
			 }
		} 
	}
	str +='<td>'+xczsrs+'</td><td></td></tr>'
	return str;
}

//放入大车合计数据
function bigCarData(json,list_time,str){
	if(json == null){
		 for(var i = 0;i<list_time.length;i++){
			    var xczsrs = 0;
				str +='<td>0</td>'
			} 
	}else{
		 var xc = 0;
		 var xczsrs = 0;
		 for(var i = 0;i<list_time.length;i++){
			 if(xc >= json.length){
				 str +='<td>0</td>'
			 }else{
				 if(json[xc].dayTime == list_time[i]){
					 var rs = json[xc].carTypeA1*1 +json[xc].carTypeA2*1+json[xc].carTypeA3*1+json[xc].carTypeB1*1+json[xc].carTypeB2*1;
						str +='<td>'+rs+'</td>'
						xc = xc*1+1;
						xczsrs = rs+xczsrs*1;
					}else{
						str +='<td>0</td>'
					} 
			 }
		} 
	}
	str +='<td>'+xczsrs+'</td><td></td></tr>'
	return str;
}
//放入小车合计数据
function data(json,list_time,str){
	if(json == null){
		 for(var i = 0;i<list_time.length;i++){
			    var xczsrs = 0;
				str +='<td>0</td>'
			} 
	}else{
		 var xc = 0;
		 var xczsrs = 0;
		 for(var i = 0;i<list_time.length;i++){
			 if(xc >= json.length){
				 str +='<td>0</td>'
			 }else{
				 if(json[xc].dayTime == list_time[i]){
					var rs =  json[xc].carTypeC1*1 +json[xc].carTypeC2*1+json[xc].carTypeC3*1
						str +='<td>'+rs+'</td>'
						xc = xc*1+1;
						xczsrs = rs+xczsrs*1;
					}else{
						str +='<td>0</td>'
					} 
			 }
		} 
	}
	str +='<td>'+xczsrs+'</td><td></td></tr>'
	return str;
}


//num是要处理的数字  v为要保留的小数位数
function decimal(num,v){
	var vv = Math.pow(10,v);
	return Math.round(num*vv)/vv;
}
</script>
</html>